import React from "react";
import { useShallow } from "zustand/react/shallow";
import EchartsInstance from "@/components/EchartsInstance";
import { useGlobalStore } from "@/stores";
import { OfflinePortalOptions } from "./options";

interface Props {
  data: Record<string, any>;
}

const OfflinePortal: React.FC<Props> = (props) => {
  const { renderer } = useGlobalStore(useShallow((state) => ({ renderer: state.renderer })));

  const config = OfflinePortalOptions(props.data);

  return <EchartsInstance className="w-full h-[200px]" renderer={renderer} options={config} />;
};

export default React.memo(OfflinePortal);
